package common.data.report
{
	import mx.rpc.events.ResultEvent;
	import mx.rpc.remoting.RemoteObject;

	/**
	 * 定位服务类
	 */
	public class ClientVisitedReportService extends RemoteObject
	{
		public var queryClientsVisitedReportCallBack:Function;
		public var queryClientVisitedReportCallBack:Function;
		public var querySingleVisitedReportCallBack:Function;
		
		
		public function ClientVisitedReportService() {
			super("clientVisitedReportService");
			this.showBusyCursor = true;
			this.getOperation("queryClientsVisitedReport").addEventListener(ResultEvent.RESULT,queryClientsVisitedReportResult,false,0,true);
			this.getOperation("queryClientVisitedReport").addEventListener(ResultEvent.RESULT,queryClientVisitedReportResult,false,0,true);
			this.getOperation("querySingleVisitedReport").addEventListener(ResultEvent.RESULT,querySingleVisitedReportResult,false,0,true);
		}
		
		public function queryClientsVisitedReport(clientIds:Array,startDate:String,endDate:String,visitLong:Number):void{
			this.getOperation("queryClientsVisitedReport").send(clientIds,startDate,endDate,visitLong);
		}
		public function queryClientVisitedReport(clientId:String,startDate:String,endDate:String):void{
			this.getOperation("queryClientVisitedReport").send(clientId,startDate,endDate);
		}
		public function querySingleVisitedReport(clientId:String,staffId:String,startDate:String,endDate:String):void{
			this.getOperation("querySingleVisitedReport").send(clientId,staffId,startDate,endDate);
		}
		
		//回调根据员工ID集合获取实时定位信息
		private function queryClientsVisitedReportResult(e:ResultEvent):void{
			try{
				if(queryClientsVisitedReportCallBack != null){
					queryClientsVisitedReportCallBack.apply(this,[e]);
				}
			}catch(error:Error){
				trace(error.getStackTrace());
			}
		}
		
		private function queryClientVisitedReportResult(e:ResultEvent):void{
			try{
				if(queryClientVisitedReportCallBack != null){
					queryClientVisitedReportCallBack.apply(this,[e]);
				}
			}catch(error:Error){
				trace(error.getStackTrace());
			}
		}
		private function querySingleVisitedReportResult(e:ResultEvent):void{
			try{
				if(querySingleVisitedReportCallBack != null){
					querySingleVisitedReportCallBack.apply(this,[e]);
				}
			}catch(error:Error){
				trace(error.getStackTrace());
			}
		}
		
		
	}
}	